<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        // replace this example code with whatever you need
        return $this->render('default/index.html.twig', [
            'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
        ]);
    }

    // name 参数并不是必须项，但以后它会非常有用，因为在链接页面时要用到。
    /**
     * @Route("/lucky", name="luckyPage")
     */
    public function luckyAction(Request $request)
    {
        // replace this example code with whatever you need
        return $this->render('default/lucky.html.twig', [
            'name' => 'finley',
            'hobbies' => ['rice', 'potato', 'beas'],
            'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
        ]);
    }
}
